package com.game.view.ui
{
	import com.game.element.KuaiPaoSkill;
	import com.game.manager.ActionManager;
	import com.game.manager.LayerManager;
	import com.game.res.UIRescource;
	import com.interfaces.game.GlobalAPI;
	import com.interfaces.general.mangaer.IDispose;
	import com.interfaces.general.mangaer.ITick;
	
	import fl.core.UIComponent;
	
	import flash.display.DisplayObject;
	import flash.text.TextField;
	
	public class UiMainView extends UIComponent implements ITick,IDispose {
		
		private var bullets_tf:TextField = new TextField;
		private var islinkflag:int = 12;
		
		private var score_tf:TextField = new TextField;
		public var skill_uic:KuaiPaoSkill = new KuaiPaoSkill; 
		
		public function UiMainView() {
			super();
			GlobalAPI.tickManager.regeditTick(this);
			
			bullets_tf.width = 200;
			bullets_tf.height = 20;
			bullets_tf.selectable = false;
			addChild(bullets_tf);
			
			score_tf.width = 200;
			score_tf.height = 20;
			score_tf.x = 300;
			score_tf.selectable = false;
			addChild(score_tf);
			
			skill_uic.y = 22;
			addChild(skill_uic);
		}
		
		public function exce():void {
			var totalStr:String = "∞";
			if(LayerManager.sceneView.playerView.baseWeapon.totalBullets != -1){
				totalStr = LayerManager.sceneView.playerView.baseWeapon.totalBullets+"";
			}
			bullets_tf.htmlText = "<font color ='#FFFFFF'>子弹:"+LayerManager.sceneView.playerView.baseWeapon.currentBullets+"/"+totalStr+"</font>";
			if(LayerManager.sceneView.playerView.baseWeapon.currentBullets == 0){
				if(islinkflag >6){
					islinkflag --;
					return;
				}
				bullets_tf.htmlText += "<font color = '#FFFFFF'>RELOAD(R)</font>";
				
				if(islinkflag <=0){
					islinkflag = 12;
				}
				
				islinkflag --;
			}
			
			score_tf.htmlText = "<font color ='#FFFFFF'>击杀了:"+LayerManager.sceneView.playerView.killedCnt+"个僵尸</font>";
		}
		
		public function set tickPriority(priority:int):void
		{
		}
		
		public function get tickPriority():int
		{
			return 0;
		}
		
		public function dispose():void{
			GlobalAPI.tickManager.unRegeditTick(this);
		}
	}
}